home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
language
/
xscheme.arc
/
xscheme.doc
< prev
next >
Wrap
Text File
|
1989-02-01
|
52KB
|
2,839 lines
XSCHEME: An Object-oriented Scheme
Version 0.16
January 9, 1989
by
David Michael Betz
P.O. Box 144
Peterborough, NH 03458
(603) 924-4145 (home)
Copyright (c) 1989, by David Michael Betz
All Rights Reserved
Permission is granted for unrestricted non-commercial use
XSCHEME TABLE OF CONTENTS Page 2
TABLE OF CONTENTS
TABLE OF CONTENTS..................................2
INTRODUCTION.......................................3
A NOTE FROM THE AUTHOR.............................4
EXPRESSIONS........................................5
BINDING FORMS.....................................10
SEQUENCING........................................11
DELAYED EVALUATION................................12
ITERATION.........................................13
DEFINITIONS.......................................14
LIST FUNCTIONS....................................15
DESTRUCTIVE LIST FUNCTIONS........................17
SYMBOL FUNCTIONS..................................18
VECTOR FUNCTIONS..................................19
ARRAY FUNCTIONS...................................20
CONVERSION FUNCTIONS..............................21
TYPE PREDICATES...................................22
EQUALITY PREDICATES...............................25
ARITHMETIC FUNCTIONS..............................26
NUMERIC COMPARISON FUNCTIONS......................29
BITWISE LOGICAL FUNCTIONS.........................30
STRING FUNCTIONS..................................31
STRING COMPARISON FUNCTIONS.......................32
CHARACTER COMPARISON FUNCTIONS....................33
INPUT/OUTPUT FUNCTIONS............................34
OUTPUT CONTROL FUNCTIONS..........................36
FILE I/O FUNCTIONS................................37
CONTROL FEATURES..................................39
ENVIRONMENT FUNCTIONS.............................40
UTILITY FUNCTIONS.................................41
SYSTEM FUNCTIONS..................................42
OBJECT REPRESENTATIONS............................43
XSCHEME INTRODUCTION Page 3
XScheme is an implementation of the Scheme programming language
with extensions to support object-oriented programming.
There are currently implementations of XScheme running on the
IBM-PC and clones under MS-DOS, on the Macintosh, the Atari-ST
and the Amiga. It is completely written in the programming
language 'C' and is easily extended with user written built-in
functions and classes. It is available in source form to non-
commercial users.
This document is a brief description of XScheme. XScheme
follows the "Revised^3 Report on the Algorithmic Language
Scheme". It assumes some knowledge of Scheme or LISP and some
understanding of the concepts of object-oriented programming.
I recommend the book "Structure and Interpretation of Computer
Programs" by Harold Abelson and Gerald Jay Sussman and published
by The MIT Press and the McGraw-Hill Book Company for learning
Scheme (and programming in general). You might also find "The
Scheme Programming Language" by R. Kent Dybvig and "The Little
Lisper" by Daniel P. Friedman and Matthias Felleisen to be
helpful.
XSCHEME A NOTE FROM THE AUTHOR Page 4
A NOTE FROM THE AUTHOR
If you have any problems with XScheme, feel free to contact me
for help or advice. Please remember that since XScheme is
available in source form in a high level language, many users
have been making versions available on a variety of machines.
If you call to report a problem with a specific version, I may
not be able to help you if that version runs on a machine to
which I don't have access. Please have the version number of
the version that you are running readily accessible before
calling me.
If you find a bug in XScheme, first try to fix the bug yourself
using the source code provided. If you are successful in fixing
the bug, send the bug report along with the fix to me. If you
don't have access to a C compiler or are unable to fix a bug,
please send the bug report to me and I'll try to fix it.
Any suggestions for improvements will be welcomed. Feel free to
extend the language in whatever way suits your needs. However,
PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME
FIRST!! I would like to be the clearing house for new features
added to XScheme. If you want to add features for your own
personal use, go ahead. But, if you want to distribute your
enhanced version, contact me first.
XSCHEME EXPRESSIONS Page 5
EXPRESSIONS
<variable>
An expression consisting of a variable is a variable
reference. The value of the variable reference is the value
stored in the location to which the variable is bound. It
is an error to reference an unbound variable.
(QUOTE <datum>)
'<datum>
(quote <datum>) evaluates to <datum>. <Datum> may be any
external representation of a Scheme object. This notation
is used to include literal constants in Scheme code. (quote
<datum>) may be abbreviated as '<datum>. The two notations
are equivalent in all respects.
<constant>
Numeric constants, string constants, character constants,
and boolean constants evaluate "to themselves"; they need
not be quoted.
(<operator> <operand>...)
A procedure call is written by simply enclosing in
parentheses expressions for the procedure to be called and
the arguments to be passed to it. The operator and operand
expressions are evaluated and the resulting procedure is
passed the resulting arguments.
(<object> <selector> <operand>...)
A message sending form is written by enclosing in
parentheses expressions for the receiving object, the
message selector, and the arguments to be passed to the
method. The receiver, selector, and argument expressions
are evaluated, the message selector is used to select an
appropriate method to handle the message, and the resulting
method is passed the resulting arguments.
XSCHEME EXPRESSIONS Page 6
(LAMBDA <formals> <body>)
<Formals> should be a formal argument list as described
below, and <body> should be a sequence of one or more
expressions. A lambda expression evaluates to a procedure.
The environment in effect when the lambda expression is
evaluated is remembered as part of the procedure. When the
procedure is later called with some actual arguments, the
environment in which the lambda expression was evaluated
will be extended by binding the variables in the formal
argument list to fr